package com.woniuxy.common.exception;

import com.woniuxy.common.api.IErrorCode;
import lombok.Getter;

/**
 * 公共接口异常
 */
@Getter
public class ApiException extends RuntimeException {

    private IErrorCode errorCode;

    private Integer code;

    public ApiException(IErrorCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public ApiException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public ApiException() {
        super();
    }

    public ApiException(String message) {
        super(message);
    }

    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApiException(Throwable cause) {
        super(cause);
    }

    public IErrorCode getErrorCode() {
        return this.errorCode;
    }
}
